//
//  PhoneNumViewController.m
//  hellomui
//
//  Created by zhangtao on 15/10/17.
//  Copyright © 2015年 zt.td. All rights reserved.
//

#import "PhoneNumViewController.h"

@interface PhoneNumViewController ()
@property(nonatomic,strong)UITextField *phoneText;
@end

@implementation PhoneNumViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self initStyle];
}

-(void)initStyle{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:240/255.f green:240/255.f blue:240/255.f alpha:1];
    
    _phoneText = [[UITextField alloc]initWithFrame:CGRectMake(20, 90,[[UIScreen mainScreen]bounds].size.width - 100 , 40)];
    _phoneText.layer.cornerRadius = 5;
    _phoneText.backgroundColor = [UIColor whiteColor];
    _phoneText.layer.borderWidth = 1;
    _phoneText.layer.borderColor = [[UIColor grayColor]CGColor];

    
    UIButton *rightButton = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetWidth(_phoneText.frame)+30, 90, 60, 40)];
    [rightButton setTitle:@"提交" forState:UIControlStateNormal];
    rightButton.titleLabel.font = [UIFont systemFontOfSize:15];
    [rightButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    rightButton.layer.cornerRadius = 5;
    
    [rightButton addTarget:self action:@selector(submit) forControlEvents:UIControlEventTouchUpInside];
    
    rightButton.backgroundColor = [UIColor whiteColor];
//    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];
//    self.navigationItem.rightBarButtonItem = rightItem;
   
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    self.title = @"手机号码";
    
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(20, 150, [[UIScreen mainScreen]bounds].size.width - 40, 30)];
    label.text = @"一天之内只能修改一次昵称哦~";
    [label setTextColor:[UIColor grayColor]];
    label.font = [UIFont systemFontOfSize:13];
    
    [self.view addSubview:label];
    [self.view addSubview:_phoneText];
    [self.view addSubview:rightButton];
}

-(void)submit{
    _infoVC.nickName.text = _phoneText.text;
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
